<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>发文详情</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <link th:href="@{/res/notice/lib/weui.min.css}" rel="stylesheet"/>
    <link th:href="@{/res/notice/css/jquery-weui.css}" rel="stylesheet"/>
    <link th:href="@{/res/notice/css/font-awesome.css?v=4.4.0}" rel="stylesheet"/>
    <link th:href="@{/res/notice/css/common.css}" rel="stylesheet"/>
</head>
<body class="bgline3 pb70">

<header class='demos-header bgwhite mb5 ptb10'>
    <h3 class="tc blue" th:text="${notice.noticeTheme}"></h3>
</header>
<article class="weui-article bgwhite">
    <!--通知类型-->
    <p>
        <span class="bold">通知类型：</span>
        <small th:text="${@dict.getValueByTableAndKey('sys_notice_type',notice.noticeType)}"></small>
    </p>
    <!--创建时间-->
    <p>
        <span class="bold">创建时间：</span>
        <small th:text="${#dates.format(notice.noticeSendingTime,'yyyy-MM-dd HH:mm')}"></small>
    </p>
    <!--发件人-->
    <p>
        <span class="bold">发件人：</span>
        <small th:text="${@dingUser.getNoticeSenderValue(notice.noticeSender)}"></small>
    </p>
    <!--署名-->
    <p>
        <span class="bold">署名：</span>
        <small th:text="${notice.noticeSignature}"></small>
    </p>
    <!--短信-->
    <p>
        <span class="bold">是否发送短信：</span>
        <small th:text="${@dict.getValueByTableAndKey('sys_notice_message',notice.noticeMessage)}"></small>
    </p>
    <!--已读-->
    <p>
        <span class="bold">已读 ：</span>
        <a th:each="yseAddressees : ${yseAddressees}">
            <small class="inline" th:text="${@dingUser.getAddresseeNameValue(yseAddressees.addresseeName)}"></small>
            <small class="inline"
                   th:text="'[ 阅读时间：'+ ${#dates.format(yseAddressees.readTime,'yyyy-MM-dd HH:mm')}+' ]'"></small>.
        </a>
    </p>
    <!--未读-->
    <p>
        <span class="bold">未读 ：</span>
        <a th:each="noAddressees : ${noAddressees}">
            <small class="inline" style="color: crimson"
                   th:text="${@dingUser.getAddresseeNameValue(noAddressees.addresseeName)}"></small>.
        </a>
    </p>
    <!--内容-->
    <!--<p>
        <span class="bold">内容：</span>
        <small th:text="${notice.noticeContent}"></small>
    </p>-->
    <!--附件-->
    <p id="down-button">
        <span class="bold">附件：</span>
        <small th:text="${file.fileName}"></small>
    </p>
    <!--参会人员-->
    <p id="sign-button">
        <span class="bold">参会人员 ：</span>
        <a th:each="signAddressees : ${signAddressees}">
            <small class="inline" th:text="${signAddressees.participantsName}"></small>.
        </a>
    </p>
    <div class="hr-line-dashed"></div>
    <!--通知回复-->
    <div class="panel panel-info">
        <div class="panel-heading">
            <i class="fa fa-info-circle"></i> 以下为通知回复
        </div>
        <div th:each="response : ${response}" class="panel-body">
            <form class="form-horizontal m-t">
                <!--时间内容-->
                <div class="form-group">
                    <p>
                        <span class="bold">回复时间：</span>
                        <small th:text="${#dates.format(response.responseTime,'yyyy-MM-dd HH:mm')}"></small>
                    </p>
                    <p>
                        <span class="bold">回复人：</span>
                        <small th:text="${@dingUser.getAddresseeNameValue(response.responseSender)}"></small>
                    </p>
                    <p>
                        <span class="bold">回复内容：</span>
                        <small th:text="${response.responseContent}"></small>
                    </p>
                </div>
                <!--附件-->
                <p>
                    <span class="bold">附件：</span>
                    <small th:text="${response.fileName}"></small>
                </p>
            </form>
        </div>
    </div>
</article>
<!--<div class="bgpart w100 ptb10 fixed btm0 flex around alcenter topshadow">
    <a class="w45 weui-btn weui-btn_plain-primary withdrawBtn"
       href="javascript:" onclick="toReturn()">撤回</a>
    <a class="w45 weui-btn weui-btn_primary retransmissionBtn"
       href="javascript:" style="margin-top: 0;" onclick="sendAgain()">重发</a>
</div>-->

<script th:src="@{/res/notice/lib/jquery-2.1.4.js}"></script>
<script th:src="@{/res/notice/js/jquery-weui.js}"></script>
<script th:src="@{/res/ajax/libs/layer/layer.min.js}"></script>
<script th:inline="javascript">
    var token = [[${token}]];
    var fileRoute = [[${file.fileRoute}]];
    var noticeId = [[${notice.noticeId}]];
    var noticeType = [[${notice.noticeType}]];
    var prefix = "/sys/common/download";
    window.onload = function () {
        if (!fileRoute) {
            document.getElementById("down-button").style.display = "none";
        }//判断有无附件，选择是否显示
        if (noticeType === "2") {
            document.getElementById("sign-button").style.visibility = "visible";
        }else {
            document.getElementById("sign-button").style.display = "none";
        }//判断是否会议通知，选择是否显示
    };
    // 撤回
    function toReturn() {
        console.log(noticeId);
        $.confirm("确定要撤回该条通知吗?", function () {
            //撤回
            var config = {
                url: "/mobile/notice/toReturn",
                type: "post",
                dataType: "json",
                data: {"id": noticeId},
                beforeSend: function (request) {
                    request.setRequestHeader("X-Access-Token", token);
                }
            };
            $.ajax(config);
            $.toast("已撤回!");
            setTimeout(function () {
                window.location.reload();//刷新当前页面.
            }, 800)
        }, function () {
            console.log("取消撤回");
        });
    }
    function sendAgain(){
        console.log(noticeId);
        $.confirm("确定要重发该条通知吗?", function () {
            //撤回
            var config = {
                url: "/mobile/notice/sendAgain",
                type: "post",
                dataType: "json",
                data: {"id": noticeId},
                beforeSend: function (request) {
                    request.setRequestHeader("X-Access-Token", token);
                }
            };
            $.ajax(config);
            $.toast("已重发!");
            setTimeout(function () {
                window.location.reload();//刷新当前页面.
            }, 800)
        }, function () {
            console.log("取消重发");
        });
    }
</script>

</body>
</html>
